package io.jnet.common.channelcontext;

import java.nio.channels.AsynchronousSocketChannel;
import java.util.concurrent.ExecutorService;
import io.jnet.common.api.AioListener;
import io.jnet.common.api.ChannelContext;
import io.jnet.common.api.ReadProcessor;
import io.jnet.common.api.WriteHandler;
import io.jnet.common.bufstorage.BufStorage;
import io.jnet.common.businessprocessor.MutlisAttachProcessor;
import io.jnet.common.decodec.FrameDecodec;
import io.jnet.common.readprocessor.MutliAttachReadHandler;
import io.jnet.common.streamprocessor.StreamProcessor;

public class MutliAttachChannelContext extends BaseChannelContext
{
    private final MutlisAttachProcessor processor;
    
    public MutliAttachChannelContext(MutlisAttachProcessor processor, ExecutorService businessExecutorService, BufStorage bufStorage, int maxMerge, AioListener aioListener, StreamProcessor[] inProcessors, StreamProcessor[] outProcessors, AsynchronousSocketChannel socketChannel, FrameDecodec frameDecodec)
    {
        super(businessExecutorService, bufStorage, maxMerge, aioListener, inProcessors, outProcessors, socketChannel, frameDecodec);
        this.processor = processor;
    }
    
    @Override
    protected ReadProcessor buildReadProcessor(ExecutorService businessExecutorService, AioListener serverListener, ChannelContext channelContext, BufStorage bufStorage, WriteHandler writeHandler, StreamProcessor[] inProcessors)
    {
        return new MutliAttachReadHandler(processor);
    }
    
}
